package com.xms.schema.api.model;

import com.xms.utils.StringUtil;
import com.xms.utils.UUIDUtil;

import java.util.UUID;

/**
 * <p>
 * CreateAttributeModel
 * </p>
 *
 * @author migo
 * @since 2021/9/16
 */
public class CreateAttributeModel {

    public String AttributeTypeName;

    public String Name;

    public String LocalizedName;

    public UUID EntityId;
    public String DefaultValue;
    public Boolean IsRequired;
    public Boolean LogEnabled;

    //int setting
    public Integer IntMinValue;
    public Integer IntMaxValue;

    //nvarchar setting
    public String TextFormat;

    public Integer MaxLength;

    //ntext setting
    public String NTextFormat;

    //float setting
    public Integer FloatPrecision;
    public Float FloatMinValue;
    public Float FloatMaxValue;

    //money setting
    public Integer MoneyPrecision;
    public Float MoneyMinValue;
    public Float MoneyMaxValue;

    //optionset setting
    public String OptionSetType;

    public Boolean[] IsCommonOptionSet;

    public void setCommonOptionSet(String value) {
        CommonOptionSet = StringUtil.notEmpty(value) ? UUIDUtil.get(value) : null;
    }

    public UUID CommonOptionSet;
    public String[] OptionSetName;
    public Integer[] OptionSetValue;
    public Boolean[] IsSelectedOption;

    //bit setting
    public String[] BitOptionName;

    //public List<Boolean> BitIsDefault;

    //datetime setting
    public String DateTimeFormat;

    //lookup setting
    public UUID LookupEntity;
    public void setLookupEntity(String value) {
        LookupEntity = StringUtil.notEmpty(value) ? UUIDUtil.get(value) : null;
    }

    public String LookupType;

    //part list setting
    public String PartyListFormat;

    public Boolean AuthorizationEnabled;
    public String Description;

    public String FormulaExpression;
    public Integer ValueType;
    public UUID SummaryEntityId;
    public void setSummaryEntityId(String value) {
        SummaryEntityId = StringUtil.notEmpty(value) ? UUIDUtil.get(value) : null;
    }
    public String SummaryExpression;
}
